﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.DCYY
{
    /// <summary>
    /// MaZuiHuLiCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class MaZuiHuLiCtrl : CustomCommonTableCtrl
    {
        public MaZuiHuLiCtrl()
        {
            InitializeComponent();
            if (DataManager.Instance.CurrentPatientLink != null)
            {
                sssj.Text = DataManager.Instance.CurrentPatientLink.Status.InRoomTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InRoomTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);
                ssrssj.Text = DataManager.Instance.CurrentPatientLink.Status.InPacuTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InPacuTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);

                sscssj.Text = DataManager.Instance.CurrentPatientLink.Status.OutPacuTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.OutPacuTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
            }
                IniteRadioBation();
        }
        private void sssj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cuText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;

            cusDatePicker.ShowDialog();

            if (cusDatePicker.Result)
            {
                cuText.Value = cusDatePicker.SelectedDateTime;//2005年11月5日
            }
        }
        private void IniteRadioBation()
        {
            new RadioButtonHelper().ChangeRadioSatus(px_y, px_n);
            new RadioButtonHelper().ChangeRadioSatus(gm_szhm, gm_cb);
            new RadioButtonHelper().ChangeRadioSatus(dx_szhm, dx_cb);
            new RadioButtonHelper().ChangeRadioSatus(zt_y, zt_n);
            new RadioButtonHelper().ChangeRadioSatus(ys_sss, mzs);
            new RadioButtonHelper().ChangeRadioSatus(szqx, szss);
            new RadioButtonHelper().ChangeRadioSatus(jm_qdwkn, jm_cgkn);
            new RadioButtonHelper().ChangeRadioSatus(qjd_h, qjd_c);
            new RadioButtonHelper().ChangeRadioSatus(qx_qdwkn, qx_cgkn);
            
        }
    }
}
